<script setup>
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'
import { useUserStore } from './store/user'

// 全局挂载用户存储
const userStore = useUserStore()

onLaunch(() => {
  console.log('App Launch')
  // 应用启动时进行静默登录
  userStore.silentLogin().then(() => {
    console.log('静默登录成功')
  }).catch(() => {
    console.log('静默登录失败，可能需要用户授权')
  })
})

onShow(() => {
  console.log('App Show')
})

onHide(() => {
  console.log('App Hide')
})
</script>

<style>
/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

page {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: #f5f5f5;
}

button {
  border-radius: 8px;
}
</style>